#include<iostream>
using namespace std;
int main(void)
{
	int s,h,sum,max1=0,i,day=0;

    for(i =0;i<7;i++)
    {
    	cin >> s >> h;
    	sum = s+h;
    	if((sum>max1)&&(sum>8))
    	{
    		max1 = sum;
    		day = i+1;
		}
	}
    cout<<day;
	return 0;
}
